#include "EntityManager.h"


EntityManager& EntityManager::GetInstance()
{
	static EntityManager instance;

	return instance;
}

void EntityManager::RegisterEntity(BaseEntity* entity)
{
	m_entityMap.insert(std::make_pair(entity->ID(), entity));
}

BaseEntity* EntityManager::GetEntityFromID(int id) const
{
	EntityMap::const_iterator it = m_entityMap.find(id);

	assert( (it != m_entityMap.end()) && "<EntityManager::GetEntityFromID>: invalid ID" );

	return it->second;
}

void EntityManager::RemoveEntity(int id)
{
	m_entityMap.erase(id);
}

void EntityManager::RemoveEntity(BaseEntity* entity)
{
	m_entityMap.erase(entity->ID());
}